// 测试节假日数据显示
const mockResponse = {
  "success": true,
  "data": {
    "period": "2024-07-20 至 2025-07-20",
    "holiday_count": 14,
    "non_holiday_count": 351,
    "holiday_stats": {
      "total_consumption": 2721238,
      "avg_consumption": 8099,
      "peak_hour": 10,
      "peak_value": 8839,
      "valley_value": 6951
    },
    "non_holiday_stats": {
      "total_consumption": 77429933,
      "avg_consumption": 9192,
      "peak_hour": 9,
      "peak_value": 10280,
      "valley_value": 7579
    },
    "holiday_hourly_pattern": [7179.61,7005.02,6951.21,6982.0,7190.02,7557.88,7882.5,8185.84,8480.45,8754.75,8839.36,8764.71,8653.5,8481.7,8350.21,8412.41,8739.48,8833.55,8682.07,8545.12,8431.96,8164.16,7837.54,7469.12],
    "non_holiday_hourly_pattern": [7765.47,7613.84,7579.2,7732.38,8185.87,8883.21,9483.52,9935.52,10170.55,10279.79,10273.13,10147.37,9975.17,9772.85,9640.72,9686.27,9927.1,9996.74,9761.03,9417.07,9098.98,8799.96,8430.14,8042.22]
  },
  "message": "比利时节假日对比分析完成"
};

// 模拟前端数据处理逻辑
function processHolidayData(response) {
  if (response.success) {
    const analysisData = response.data;
    
    const holidayData = {
      holidayStats: analysisData.holiday_stats,
      nonHolidayStats: analysisData.non_holiday_stats,
      holidayHourlyData: analysisData.holiday_hourly_pattern.map((load, hour) => ({
        hour: hour,
        consumption: Math.round(load || 0)
      })).filter(item => item.consumption > 0),
      nonHolidayHourlyData: analysisData.non_holiday_hourly_pattern.map((load, hour) => ({
        hour: hour,
        consumption: Math.round(load || 0)
      })).filter(item => item.consumption > 0)
    };
    
    console.log('处理后的数据:', holidayData);
    console.log('节假日统计:', holidayData.holidayStats);
    console.log('非节假日统计:', holidayData.nonHolidayStats);
    
    return holidayData;
  }
}

// 测试数据处理
const processedData = processHolidayData(mockResponse);

console.log('=== 数据验证 ===');
console.log('节假日总用电量:', processedData.holidayStats.total_consumption);
console.log('节假日平均负荷:', processedData.holidayStats.avg_consumption);
console.log('节假日峰值负荷:', processedData.holidayStats.peak_value);
console.log('节假日谷值负荷:', processedData.holidayStats.valley_value);

console.log('非节假日总用电量:', processedData.nonHolidayStats.total_consumption);
console.log('非节假日平均负荷:', processedData.nonHolidayStats.avg_consumption);
console.log('非节假日峰值负荷:', processedData.nonHolidayStats.peak_value);
console.log('非节假日谷值负荷:', processedData.nonHolidayStats.valley_value); 